package org.luxor.cloud.portal.service;

import org.luxor.cloud.portal.service.hystrix.UserDetailsHystrixImpl;
import org.luxor.commons.core.web.data.R;
import org.luxor.commons.security.entity.UserSubject;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * 远程RPC调用用户服务
 *
 * @author Mr.Yan  @date: 2020/9/2
 */
@FeignClient(name = "luxor-cloud-users", path = "userDetails", fallback = UserDetailsHystrixImpl.class)
public interface IUserDetailsFeign {

    /**
     * 根据登陆账号获取详情信息
     *
     * @param username 登陆账号
     * @return 账号详情
     */
    @GetMapping(value = "/loadUserByUsername/{username}")
    R<UserSubject> loadUserByUsername(@PathVariable String username);

    /**
     * 当前登陆用户
     * @return 单前登陆账号详情
     */
    @GetMapping(value = "/user")
    R<UserSubject> user();

}
